package exercise;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Double[] arr = new Double[6];

        // 输入分数
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请第" + (i + 1) + "位评委打分：");
            arr[i] = scanner.nextDouble();
        }

        int minIndex = 0;
        int maxIndex = 0;
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] < arr[minIndex]) {
                minIndex = i;
            }
            if (arr[i] > arr[maxIndex]) {
                maxIndex = i;
            }
        }
        double sum = 0;
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if (i != minIndex && i != maxIndex) {
                sum += arr[i];
                count++;
            }
        }

        System.out.println("最终平均分：" + sum / count);
    }
}